package com.leapcloud.crm.core.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * @author motorfu
 * @email ffu@maxleap.com
 * @since 2018/8/29 20:11
 */
@Configuration
@EnableSwagger2
public class SwaggerConfig {


  public ApiInfo apiInfo() {
    return new ApiInfoBuilder().title("力谱云CRM协助系统")
        .description("力谱云CRM协助系统 API")
        .license("")
        .licenseUrl("")
        .termsOfServiceUrl("")
        .contact(new Contact("力谱云", "", ""))
        .build();
  }

  @Bean
  public Docket assistApi() {
    return new Docket(DocumentationType.SWAGGER_2)
        .groupName("assist-api")
        .genericModelSubstitutes()
        .useDefaultResponseMessages(false)
        .forCodeGeneration(true)
        .select()
        .apis(RequestHandlerSelectors.basePackage("com.leapcloud.crm.assist"))
        .build().apiInfo(apiInfo());
  }

//  @Bean
//  public Docket systemApi() {
//    return new Docket(DocumentationType.SWAGGER_2)
//        .groupName("system-api")
//        .genericModelSubstitutes()
//        .useDefaultResponseMessages(false)
//        .forCodeGeneration(true)
//        .select()
//        .apis(RequestHandlerSelectors.basePackage("com.leapcloud.ims.system"))
//        .build().apiInfo(apiInfo());
//  }


}
